#!/usr/bin/ruby -w

def triangle?(x, y, z)
  if x <= 0 || y <= 0 || z <= 0
    return "Not a triangle"
  elsif (x + y) <= z || (y + z) <= x || (z + x) <= y
    return "Not a triangle"
  elsif x == y && y == z
    return "Equilateral"
  elsif x == y || y == z || x == z
    return "Isosceles"
  elsif pythagoras?(x, y, z) || pythagoras?(x, z, y) || pythagoras?(y, z, x)
    return "Rectangular"
  else
    return "Other"
  end
end

def pythagoras?(a, b, c)
  return a ** 2 + b ** 2 == c ** 2
end

if __FILE__ == $PROGRAM_NAME
  if ARGV.length != 3
    abort("Usage: ./triangle.rb [length] [length] [length]")
  end

  puts triangle?(ARGV[0].to_i, ARGV[1].to_i, ARGV[2].to_i)
end
